package com.hsource.common.utils;

import lombok.Getter;
import lombok.Setter;
import org.springframework.validation.BindingResult;

/**
 * 通用返回对象
 * @Author itoug
 * @Crreate 2020-09-04 8:57
 */
@Getter
@Setter
public class CommonCallBackResp {

    //操作成功
    public static final int SUCCESS = 0;
    //操作失败
    public static final int FAILED = -1;
    private int error;
    private String error_msg;

    /**
     * 普通成功返回
     *
     */
    public CommonCallBackResp success() {
        this.error = SUCCESS;
        this.error_msg = "操作成功";
        return this;
    }


    /**
     * 普通失败提示信息
     */
    public CommonCallBackResp failed() {
        this.error = FAILED;
        this.error_msg = "操作失败";
        return this;
    }
}
